package com.freecloud.spring.formework.webmvc.servlet;

import lombok.Data;

import java.lang.reflect.Method;
import java.util.Comparator;
import java.util.regex.Pattern;

/**
 * @Author: maomao
 * @Date: 2019-12-13 15:07
 */
@Data
public class FCHandlerMapping implements Comparator {

    /**  方法对应的实例 */
    private Object controller;

    /** 具体方法实现 */
    private Method method;

    /** URL正则匹配 */
    private Pattern pattern;

    public FCHandlerMapping(Pattern pattern, Object controller,Method method) {
        this.pattern = pattern;
        this.method = method;
        this.controller = controller;

    }

    @Override
    public int compare(Object o1, Object o2) {
        return o1.toString().equals(o2) ?  0 :  1;
    }
}
